type Config = Record<string, any>;
type RequestTask = {
	abort : () => void;
	offHeadersReceived : () => void;
	onHeadersReceived : () => void;
};
interface RequestOption<C extends Record<string, any> = Record<string, any>> {
	baseURL ?: string;
	withCredentials?:boolean
	data ?: Record<string, any> | Array<any> | string;
	params ?: Record<string, any>;
	header ?: Record<string, string>;
	responseType ?: "text" | "arraybuffer";
	dataType ?: "json";
	custom?: C;
}
interface RequestConfig<C extends Record<string, any> = Record<string, any>> {
	baseURL : string;
	url ?: string;
	data ?: Record<string, any> | Array<any> | string;
	params ?: Record<string, any>;
	header ?: Record<string, string>;
	responseType ?: "text" | "arraybuffer";
	dataType ?: "json";
	custom ?: C;
	method :
	| "GET"
	| "POST"
	| "PUT"
	| "DELETE"
	| "CONNECT"
	| "HEAD"
	| "OPTIONS"
	| "TRACE"
	| "DOWNLOAD"
	| "UPLOAD";
	timeout : number;
	sslVerify ?: boolean;
	withCredentials ?: boolean;
	firstIpv4 ?: boolean;
	validateStatus : (code : number) => boolean;
	modifyData : <T, D = T>(request : Promise<T>,c:PartialRequestConfig) => Promise<D>;
}
interface UpLoadOption<C extends Record<string, any> = Record<string, any>> {
	header ?: Record<string, string>;
	files ?: Array<File>;
	fileType ?: "image" | "video" | "audio";
	filePath ?: string;
	name ?: string;
	timeout ?: number;
	formData ?: Record<string, any>;
	custom ?: C;
}

interface UpLoadConfig<C extends Record<string, any> = Record<string, any>> extends UpLoadOption<C> {
	baseURL ?: string;
	withCredentials?:boolean
	
}

interface DownLoadConfig {
	timeout ?: number;
	header ?: Record<string, string>;
}
interface DispatchRequestConfig<C extends Record<string, any> = Record<string, any>> extends RequestConfig<C>, UpLoadOption<C> {
	
	fullPath ?: string;
	url : string;
	timeout : number;
	complete : (r : RequestResponse) => void;
	getTask ?: (requestTask : RequestTask, config : DispatchRequestConfig) => void;
}
interface RequestResponse extends DispatchRequestConfig {
	config : DispatchRequestConfig;
	statusCode : number;
	data : string | Record<string, any>;
}
interface DispatchRequest {
	(config : DispatchRequestConfig) : Promise<DispatchRequestConfig>;
}
interface RequestExample<T> {
	(config : T) : Promise<T> | T;
}
interface CustomResponse<T,C extends Record<string, any> = Record<string, any>> {
	cookies:string[],
	header:Record<string,string>
	config : DispatchRequestConfig<C>;
	statusCode : number;
	data : T;
}

interface PartialRequestConfig extends Partial<RequestConfig>, RequestOption { }

export type {
	Config,
	RequestOption,
	RequestConfig,
	UpLoadConfig,
	DownLoadConfig,
	DispatchRequestConfig,
	DispatchRequest,
	RequestResponse,
	RequestExample,
	CustomResponse,
	PartialRequestConfig,
};